package com.syni.mdd.sjb.common.datatreaure.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.syni.mdd.sjb.common.component.mybatis.dxshapp.entity.DankClientGroup;
import com.syni.mdd.sjb.common.component.mybatis.dxshapp.mapper.DankClientGroupMapper;
import com.syni.mdd.sjb.common.datatreaure.service.DankClientGroupService;
import com.syni.mdd.sjb.common.datatreaure.constants.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lcc
 * @since 2020-10-23
 */
@Service
public class DankClientGroupServiceImpl extends ServiceImpl<DankClientGroupMapper, DankClientGroup> implements DankClientGroupService {

    @Autowired
    DankClientGroupMapper dankClientGroupMapper;

    @Override
    public List<DankClientGroup> findByUserId(Integer userId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(DankClientGroup.USER_ID, userId);
        return dankClientGroupMapper.selectList(queryWrapper);
    }

    @Override
    public List<DankClientGroup> getCanEditData(Integer userId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(DankClientGroup.USER_ID, userId);
        queryWrapper.eq(DankClientGroup.IS_EDIT, Constants.COMMON_FLAG_TRUE_INT);
        return dankClientGroupMapper.selectList(queryWrapper);
    }

    @Override
    public List<DankClientGroup> getSelectedTag(Integer userId, Integer isSelect) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(DankClientGroup.USER_ID, userId);
        queryWrapper.eq(DankClientGroup.IS_SELECT, isSelect);
        queryWrapper.orderByAsc(DankClientGroup.TAG_ORDER);
        return dankClientGroupMapper.selectList(queryWrapper);
    }



}
